import request from '@/utils/request'

export const login = (req: UserLoginPost['req']): Promise<UserLoginPost['resp']> => {
  return request.post('/user/login', req)
}

export const getUserList = (req: UserListGet['req']): Promise<UserListGet['resp']> => {
  return request.get('/user/list', {
    params: req
  })
}

export const getUserMessageList = (req: UserMessageListGet['req']): Promise<UserMessageListGet['resp']> => {
  return request.get('/user/message/list', {
    params: req
  })
}

export const getUserMessageByUserId = (userId:UserMessageGet['userId']):Promise<UserMessageGet['resp']> => {
  return request.get('/user/message',{
    params:{userId}
  })
}


export const addUser = (req: UserRegisterPost['req']): Promise<UserRegisterPost['resp']> => {
  return request.post('/user/register', req)
}

export const getUserPermissionList = (req: UserPermissionListGet['req']): Promise<UserPermissionListGet['resp']> => {
  return request.get('/user/userPermission/list', {
    params: req
  })
}